<template>
  <div class="tag-cloud">
    <div class="tag-cloud__title">
      标签 - <span class="tag-cloud__amount">{{ total }}</span>
    </div>
    <div class="tag-cloud-tags">
      <router-link
        v-for="item in list"
        :key="item"
        :to="{path:'/tags/'+item}"
        style="font-size:15px;color:#619b13"
      >
        {{ item }}
      </router-link>
    </div>
  </div>
</template>

<script>
import { tagsList } from '@/api/tags'

export default {
  name: 'Tags',
  components: {},
  data() {
    return {
      list: [],
      total: 0
    }
  },
  created() {
    document.title = '标签'
    this.getTagsList()
  },
  methods: {
    getTagsList() {
      tagsList().then(response => {
        if (response.data.code === 20000) {
          this.list = response.data.payload.tags
          this.total = response.data.payload.total
        }
      })
    }
  }
}
</script>
